home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / calldlls / frmmenus.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1993-04-27  |  3.2 KB  |  101 lines

  1. VERSION 2.00
  2. Begin Form frmMenus 
  3.    Caption         =   "Form2"
  4.    Height          =   3450
  5.    Left            =   1290
  6.    LinkTopic       =   "Form2"
  7.    ScaleHeight     =   2760
  8.    ScaleWidth      =   5145
  9.    Top             =   3720
  10.    Width           =   5265
  11.    Begin Menu mnuBar 
  12.       Caption         =   "Sounds"
  13.       Index           =   1
  14.       Begin Menu mnuSounds 
  15.          Caption         =   "(no sounds)"
  16.          Enabled         =   0   'False
  17.          Index           =   0
  18.       End
  19.    End
  20.    Begin Menu mnuBar 
  21.       Caption         =   "System Info"
  22.       Index           =   2
  23.       Begin Menu mnuSysInfo 
  24.          Caption         =   "&Windows"
  25.          Index           =   0
  26.       End
  27.       Begin Menu mnuSysInfo 
  28.          Caption         =   "&CPU"
  29.          Index           =   1
  30.       End
  31.       Begin Menu mnuSysInfo 
  32.          Caption         =   "&Video"
  33.          Index           =   2
  34.       End
  35.       Begin Menu mnuSysInfo 
  36.          Caption         =   "&General"
  37.          Index           =   3
  38.       End
  39.       Begin Menu mnuSysInfo 
  40.          Caption         =   "-"
  41.          Index           =   4
  42.       End
  43.       Begin Menu mnuSysInfo 
  44.          Caption         =   "Always on top"
  45.          Index           =   5
  46.       End
  47.    End
  48. Option Explicit
  49. Sub Form_Load ()
  50. Dim WinPath As String, SoundFile As String, i As Integer
  51.     WinPath = WindowsDirectory()
  52.     SoundFile = Dir(WinPath & "\" & "*.wav")
  53.     If WindowsVersion() > 3# Then
  54.         If waveOutGetNumDevs() = 0 Then
  55.             ' No wave output devices available.
  56.             mnuSounds(0).Caption = "No Wave audio device available"
  57.         ElseIf SoundFile = "" Then
  58.             ' No sound files in Windows directory
  59.             Exit Sub
  60.         Else
  61.             mnuSounds(0).Caption = Left(SoundFile, InStr(1, SoundFile, ".") - 1)
  62.             mnuSounds(0).Enabled = True
  63.             i = 1
  64.             Do
  65.                 SoundFile = Dir
  66.                 If SoundFile = "" Then Exit Do
  67.                 Load mnuSounds(i)
  68.                 mnuSounds(i).Caption = Left(SoundFile, InStr(1, SoundFile, ".") - 1)
  69.                 i = i + 1
  70.             Loop
  71.         End If
  72.     Else
  73.         ' Wave audio and "always on top" only available in Windows 3.1+
  74.         Unload mnuSysInfo(5)
  75.         Unload mnuSysInfo(4)
  76.     End If
  77. End Sub
  78. Sub mnuSounds_Click (Index As Integer)
  79. Dim R As Integer
  80. Const SYNC = 1
  81.     R = sndPlaySound(ByVal CStr(WindowsDirectory() & "\" & mnuSounds(Index).Caption & ".wav"), SYNC)
  82. End Sub
  83. Sub mnuSysInfo_Click (Index As Integer)
  84.     If Index <> 5 Then
  85.         If VisibleFrame Is Nothing Then
  86.             frmCallDlls!fraInfo(0).Visible = False
  87.         Else
  88.             VisibleFrame.Visible = False
  89.         End If
  90.         frmCallDlls!fraInfo(Index + 1).Visible = True
  91.         Set VisibleFrame = frmCallDlls!fraInfo(Index + 1)
  92.     Else
  93.         mnuSysInfo(Index).Checked = Not mnuSysInfo(Index).Checked
  94.         If mnuSysInfo(Index).Checked Then
  95.             SetWindowPos frmCallDlls.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW
  96.         Else
  97.             SetWindowPos frmCallDlls.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW
  98.         End If
  99.     End If
  100. End Sub
  101.